package com.giscloud.amp.service.auth.impl;

import com.giscloud.amp.dao.YunServiceInfoMapper;
import com.giscloud.amp.entity.YunServiceInfo;
import com.giscloud.amp.entity.YunServiceInfoExample;
import com.giscloud.amp.service.auth.YunServiceInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author gxd
 * @data 2018/8/1 9:36
 */
@Service("yunServiceInfoService")
@Transactional(propagation= Propagation.REQUIRED, rollbackFor=Exception.class)
public class YunServiceInfoServiceImpl implements YunServiceInfoService {

    @Autowired
    YunServiceInfoMapper yunServiceInfoMapper;

    @Override
    public List<YunServiceInfo> selectByExample(String mapCode) {
        YunServiceInfoExample yunServiceInfoExample = new YunServiceInfoExample();
        YunServiceInfoExample.Criteria criteria = yunServiceInfoExample.createCriteria();
        criteria.andServiceUrlEqualTo(mapCode.replace("\"", ""));
        return yunServiceInfoMapper.selectByExample(yunServiceInfoExample);
    }

    @Override
    public YunServiceInfo selectByPrimaryKey(Long serviceId) {
        return yunServiceInfoMapper.selectByPrimaryKey(serviceId);
    }
}
